package com.freewater.javabase.demo.designpattern.command2.simple.invoker;

import com.freewater.javabase.demo.designpattern.command2.simple.command.Command;

/**
 * 调用者（Invoker）。接受命令对象，然后调用命令对象的接口方法委托命令对象执行实际的调用过程
 * Created by FreeWater on 2017/4/4.
 */
public class SimpleRemoteController {
	private Command slot;// 持有命令对象的引用

	public SimpleRemoteController(){};

	public void setSlot(Command slot) {// 可以运行时改变命令对象
		this.slot = slot;
	}

	public void buttonWasPressed(){// 调用命令对象方法让命令对象去调用接收者/执行者完成具体的功能
		this.slot.execute();
	}
}
